﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ajax_getpermission : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int userId = Int32.Parse(Request.QueryString["userId"]);
            int projectId = Int32.Parse(Request.QueryString["projectId"]);
            string sql = " SELECT permission FROM UserProject " +
                         " Where userId=" + comm.to_sql(userId.ToString(), "number") +
                         " AND projectId=" + comm.to_sql(projectId.ToString(), "number");
            DataTable dtTable = dal.SelectTable(sql);
            if (dtTable.Rows.Count != 1)
                throw new Exception("FAIL");
            throw new Exception(dtTable.Rows[0]["permission"].ToString());
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
}
